﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Linq;
using System.Linq.Expressions;
namespace PlanoAulaHelper.Reports
{
    public partial class relDiaNaoUteisForm : System.Windows.Forms.FormEdicao
    {

        public relDiaNaoUteisForm(int anoSelecionado) : base(anoSelecionado)
        {
            InitializeComponent();
        }
        private void AtualizarDados()
        {
            using (dbContext db = new dbContext())
            {
                var dados = from dias in db.DiaNaoUtils
                            where IdItem == 0 || dias.Data.Year == IdItem 
                            orderby dias.Data ascending
                            select dias;
                reportViewer1.LocalReport.DataSources[0].Value = dados.ToADOTable();
            }
        }
        private void relDiaNaoUteisForm_Load(object sender, EventArgs e)
        {
            AtualizarDados();
            this.reportViewer1.RefreshReport();
        }

        private void reportViewer1_ReportRefresh(object sender, CancelEventArgs e)
        {
            AtualizarDados();
        }
    }
}
